<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//夺宝商品表
class Go_shoplist_model extends CI_Model{
    function __construct() {
        parent::__construct();
        $this->go_shoplist = 'go_shoplist';
    }
    
    //获取正在进行夺宝中的商品总数
    function get_shoplist_count($where){
        $this->db->select($this->go_shoplist.'.*');
        $this->db->from($this->go_shoplist);
        $this->db->where($where);
        return $this->db->get()->num_rows();
    }
    
    function get_shoplist_one($where){
        $this->db->select($this->go_shoplist.'.*');
        $this->db->from($this->go_shoplist);
        $this->db->where($where);
        $this->db->order_by($this->go_shoplist.".id DESC");
        $this->db->limit(1,0);
        return $this->db->get()->row_array();
    }
    
    //获取正在进行夺宝中的商品列表
    function get_shoplist($where,$page,$limit){
        $this->db->select($this->go_shoplist.'.*');
        $this->db->from($this->go_shoplist);
        $this->db->order_by($this->go_shoplist.".shenyurenshu ASC");
        $this->db->where($where);
        $this->db->limit($limit,$page);
        return $this->db->get()->result_array();
    }
    
}
